/**
 * @param {number[]} target
 * @param {number} n
 * @return {string[]}
 */
var buildArray = function(target, n) {
  let result = [], count = 0;
  for(let i = 1; i <= n; i++) {
    if(target[count] == i) {
      result.push("Push");
      count++;
    } else {
      if(count != target.length) {
        result.push("Push");
        result.push("Pop");
      }
    }
  }
  return result;
};
let target = [1,3], n = 3;
console.log(buildArray(target, n));
target = [1,2,3], n = 3;
console.log(buildArray(target, n));
target = [1,2], n = 4;
console.log(buildArray(target, n));
